package per.jdz.demo.service.impl;

import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import per.jdz.demo.config.FilePathConfigProperty;
import per.jdz.demo.dao.OriginLandDataMapper;
import per.jdz.demo.domain.entity.OriginLandData;
import per.jdz.demo.readlistener.GenericReadListener;
import per.jdz.demo.service.OriginLandDataService;
import per.jdz.demo.service.ProcessFileService;
import per.jdz.demo.utils.FileUtil;

import javax.annotation.Resource;

/**
 * @author Jdz
 * @date 2025/1/6
 */
@Service
public class OriginLandDataServiceImpl extends ServiceImpl<OriginLandDataMapper, OriginLandData> implements OriginLandDataService, ProcessFileService {
    @Resource
    private FilePathConfigProperty filePathConfigProperty;
    @Resource
    private OriginLandDataMapper originLandDataMapper;
    @Override
    public void insertData(GenericReadListener.BatchProcessor batchProcessor) {
        FileUtil.insertData(filePathConfigProperty.getSplitLand(), OriginLandData.class, batchProcessor);
    }

    @Override
    public String splitFile() {
        return FileUtil.splitFile(filePathConfigProperty.getOriginLandFileDir(), filePathConfigProperty.getSplitLand(), OriginLandData.class);
    }

    @Override
    public void distinctData() {
        originLandDataMapper.distinctData();
    }

    @Override
    public void syncData() {
        //TODO
    }

    @Override
    public void matchCommonId() {

    }
}
